package com.pf.java;

import java.util.Arrays;
import java.util.Collection;
import java.util.Date;
import java.util.HashSet;

/**
 * @author pf
 * @data 2021/10/27-9:24
 */
public class collection {
    private static Date d = new Date();

    public static void main(String[] args) {
        Collection c = new HashSet();

        c.add(d);
        c.add("aaa");
        c.add(12);//隐含的自动装箱

        System.out.println(c); // 自动调用toString()
        System.out.println(Arrays.toString(c.toArray()));
        System.out.println(c.size());

        System.out.println(c.contains(d));//是否包含某个数据
        System.out.println(c.contains("aaa"));
        System.out.println(c.contains(11));

        c.remove(12);
        System.out.println(c);

        c.clear();
        System.out.println(c);


    }
}
